import { createRouter, createWebHistory } from 'vue-router'
import AxiosTest from '../views/test/AxiosTest.vue'

import testRouters from './modules/test'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/axiosTest'
    },
    {
      path: '/axiosTest',
      name: 'axios请求封装测试',
      component: AxiosTest
    },
    {
      path: '/keepAliveTest',
      name: '路由缓存测试',
      component: () => import('@/views/test/Test.vue')
    },
    {
      path: '/keepAliveTest2',
      name: '路由缓存测试2',
      component: () => import('@/views/test/Test2.vue')
    },
    {
      path: '/piniaTest',
      name: 'pinia测试',
      component: () => import('@/views/test/Test3.vue')
    },
    {
      path: '/piniaTest2',
      name: 'pinia测试2',
      component: () => import('@/views/test/Test4.vue')
    },
    {
      path: '/nestedRouterTest',
      name: '嵌套路由',
      redirect: '/nestedRouterTest/routerTest',
      component: () => import('@/views/test/NestedRouter.vue'),
      children: [...testRouters]
    },
    {
      path: '/formatTimeTest',
      name: 'formatTime测试',
      component: () => import('@/views/test/FormatTimeTest.vue')
    }
  ]
})

export default router
